package com.zhuoshi.utils;

import java.security.MessageDigest;

/**
 * 加密解密类
 * @author Administrator
 *
 */
public class DESEncrypt {
	/**
	 * 使用MD5对Text进行加密
	 * @param Text
	 * @return
	 */
	public static String encryptMD5(String Text){
		String des = "";
		try {
			MessageDigest md = MessageDigest.getInstance("MD5");
			byte[] result = md.digest(Text.getBytes());
			StringBuffer buf = new  StringBuffer();
			for(int i=0;i<result.length;i++){
				byte b = result[i];
				buf.append(String.format("%02X", b));
			}
			des = buf.toString().toUpperCase();
		} catch (Exception e) {
			e.printStackTrace();
			throw new RuntimeException("MD5 encrypt failure");
		}
		
		
		return des;
	}

}
